﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace SystemWFH.Infrstructer
{
    public interface IBaseRepository<T> where T : class ,new()
    {

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> Add(T entity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<int> Deletes(T id);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> Update(T entity);
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAll();
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> GetValue(int id);
        /// <summary>
        /// 带条件查询
        /// </summary>
        /// <param name="predicate"></param>
        /// <returns></returns>
        Task<List<T>> GetAsync(Expression<Func<T, bool>> predicate);
        /// <summary>
        /// 删除（批量）
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        Task<int> GetDelete(List<T> expression);
        /// <summary>
        /// 显示
        /// </summary> 
        /// <returns></returns>
        IQueryable<T> GetAlls();

    }
}
